
import os

inputPath = input("请输入要搜索的路径:")
pattern = input("请输入要搜索的关键词:")
for dirpath, dirnames, filenames in os.walk(inputPath):
    for f in filenames:
        if pattern in f:
            print(f'{dirpath}/{f}')
    for d in dirnames:
        if pattern in d:
            print(f'{dirpath}/{d}')



# import os
# inputPath = input('请输入待搜索路径: ')
# pattern = input('请输入待搜索关键词: ')
# for dirpath, dirnames, filenames in os.walk(inputPath):
#     for f in filenames:
#          if pattern in f:
#             print(f'{dirpath}/{f}')